package com.mengxuegu.gateway.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
@Getter
public enum ApplicationEnum {
    AUTHSERVER("auth-server", "alibaba-study-oauth2"),
    RBACSERVER("rbac-server", "alibaba-study-rbac");

    private String serviceKey;
    private String serviceName;

    public static String getNameByKey(String serviceKey) {
        ApplicationEnum[] values = values();
        for(ApplicationEnum element: values) {
            if(element.getServiceKey().equals(serviceKey)) {
                return element.getServiceName();
            }
        }
        return serviceKey;
    }
}
